package com.csap.framework.oauth2.server.entity;

import com.csap.framework.annotation.apidoc.Description;
import com.csap.framework.oauth2.server.model.RolesAttributeModel;
import com.csap.mybatisplus.annotation.IdType;
import com.csap.mybatisplus.annotation.TableField;
import com.csap.mybatisplus.annotation.TableId;
import com.csap.mybatisplus.annotation.TableName;
import com.csap.mybatisplus.extension.activerecord.Model;
import com.csap.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 角色属性
 * </p>
 *
 * @author yangchengfu
 * @dateTime 2021-07-25 23:51:30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "roles_attribute", autoResultMap = true)
@Description(value = "角色属性实体类")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class RolesAttributeEntity extends Model<RolesAttributeEntity, RolesAttributeModel> {
    /**
     * 角色ID
     */
    @TableId(type = IdType.AUTO, value = "id")
    private Long id;
    /**
     * 属性名
     */
    private String name;
    /**
     * 属性值
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<String> value;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    /**
     * 角色的ID
     */
    private Long roleId;
    /**
     * 描述
     */
    private String descr;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
